import request from '@/utils/request'

// 工序任务开工
export function startWorkOrderTask(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/start/' + taskId,
    method: 'put'
  })
}

// 工序任务完成
export function completeWorkOrderTask(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/complete/' + taskId,
    method: 'put'
  })
}

// 工序任务暂停
export function pauseWorkOrderTask(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/pause/' + taskId,
    method: 'put'
  })
}

// 工序任务重启
export function restartWorkOrderTask(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/restart/' + taskId,
    method: 'put'
  })
}

// 获取工序任务列表
export function listWorkOrderTask(query) {
  return request({
    url: '/ldzl-sc/workordertask/list',
    method: 'get',
    params: query
  })
}

// 获取工序任务详情
export function getWorkOrderTask(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/' + taskId,
    method: 'get'
  })
}

// 获取工序任务物料清单
export function getTaskMaterials(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/' + taskId + '/materials',
    method: 'get'
  })
}

// 获取工序任务报工记录
export function getTaskReports(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/' + taskId + '/reports',
    method: 'get'
  })
}

// 获取工序任务退料记录
export function getTaskReturns(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/' + taskId + '/returns',
    method: 'get'
  })
}

// 获取工序任务执行进度
export function getTaskProgress(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/' + taskId + '/progress',
    method: 'get'
  })
}

// 获取工序任务派工信息
export function getTaskDispatch(taskId) {
  return request({
    url: '/ldzl-sc/workordertask/' + taskId + '/dispatch',
    method: 'get'
  })
}